function useTest() {

  function loadTif1(params = 'GF1_MSS_CROP.tif') {
    earth.sceneTree.root.children.push({
      ref: params,
      czmObject: {
        xbsjType: "Imagery",
        name: params,
        xbsjImageryProvider: {
          type: "WebMapServiceImageryProvider",
        },
      },
    });
    setTimeout(() => {
      const layerRef = earth.sceneTree.$refs[name];
      layerRef.czmObject.xbsjImageryProvider.WebMapServiceImageryProvider._imageryProvider = basemapSource;
      // 将对 _imagelayer 的设置放在 then() 方法内部
      _imagelayer[layerRef.czmObject.xbsjGuid] = layerRef.czmObject;
      window._imagelayer = _imagelayer;
    }, 500);
  }

  // function loadTif(params = '1743049067028.tif') {
  function loadTif(params = '1743049067028.tif') {

      let imgopt = {
        // 这里是你的 geoserver服务点击查看图层的 url
        url: "/imgexpress/wms",
        // 这里是自定义的图层名称
        parameters: {
          service: "WMS",
          FORMAT: "image/png",
          version: '1.3.0',
          TRANSPARENT: true,
          LAYERS: params,
          crs: 'EPSG:4326'
          // LAYERS: "test_tif:TRIPLESAT_2_MS_L1_20201226020854_002764VI_003",
        },
        // rectangle: rec,
        minimumLevel: 0,
        maximumLevel: 18,
      }

      // -122.34374999999999
      // 43.2421875 -121.9921875 43.59375

      // 左上 -124.223785400391 40.957031250000
      // 右下 -124.027404785156 40.785369873047

      let rec = Cesium.Rectangle.fromDegrees(-124.223785400391, 40.785369873047, -124.027404785156, 40.957031250000)
        imgopt.rectangle = rec

      let basemapSource = new Cesium.WebMapServiceImageryProvider(
        imgopt
      );
      let imageLayer = viewer.imageryLayers.addImageryProvider(basemapSource);
      
  }

  return{
    loadTif
  }
}

export {useTest}